#include<iostream>
#include<signal.h>
#include<unistd.h>
using namespace std;

void Printsignal (const sigset_t &pending)
{
     for(int signo = 31; signo > 0; signo--)
    {
        if(sigismember(&pending, signo))
        {
            std::cout << "1";
        }
        else
        {
            std::cout << "0";
        }
    }
    std::cout << "\n";
}

void handler(int signo)
{
    cout<<"signo: "<<signo<<endl;
    /* while(1)
    {
        sleep(1);
        sigset_t pending;
        sigpending(&pending);
        Printsignal(pending);

    } */
}

int main()
{
    cout<<"pid: "<<getpid()<<endl;
    struct sigaction act,oact;
    sigemptyset(&act.sa_mask);
    sigemptyset(&oact.sa_mask);

    sigaddset(&act.sa_mask,2);
    sigaddset(&act.sa_mask,3);  //对act 结构体添加对从3号xin
    //sigaddset(&act.sa_mask,4);

    act.sa_handler=handler;

    sigaction(2,&act,&oact);   
    
    while(1)
    sleep(1);

    int cnt =0;
    
}